package com.ruoyi.project.simple.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IdUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.simple.mapper.SplOrderDetailReportMapper;
import com.ruoyi.project.simple.domain.SplOrderDetailReport;
import com.ruoyi.project.simple.service.ISplOrderDetailReportService;

/**
 * 样品报告Service业务层处理
 *
 * @author zhujj
 * @date 2020-01-09
 */
@Service
public class SplOrderDetailReportServiceImpl implements ISplOrderDetailReportService
{
    @Autowired
    private SplOrderDetailReportMapper splOrderDetailReportMapper;

    /**
     * 查询样品报告
     *
     * @param orderDetailReportId 样品报告ID
     * @return 样品报告
     */
    @Override
    public SplOrderDetailReport selectSplOrderDetailReportById(String orderDetailReportId)
    {
        return splOrderDetailReportMapper.selectSplOrderDetailReportById(orderDetailReportId);
    }

    /**
     * 查询样品报告列表
     *
     * @param splOrderDetailReport 样品报告
     * @return 样品报告
     */
    @Override
    public List<SplOrderDetailReport> selectSplOrderDetailReportList(SplOrderDetailReport splOrderDetailReport)
    {
        return splOrderDetailReportMapper.selectSplOrderDetailReportList(splOrderDetailReport);
    }

    /**
     * 新增样品报告
     *
     * @param splOrderDetailReport 样品报告
     * @return 结果
     */
    @Override
    public int insertSplOrderDetailReport(SplOrderDetailReport splOrderDetailReport)
    {

        splOrderDetailReport.setOrderDetailReportId(IdUtils.fastSimpleUUID());
        splOrderDetailReport.setUpdateBy(SecurityUtils.getUsername());
        splOrderDetailReport.setCreateBy(SecurityUtils.getUsername());
        splOrderDetailReport.setCreateTime(DateUtils.getNowDate());
        splOrderDetailReport.setUpdateTime(DateUtils.getNowDate());
        return splOrderDetailReportMapper.insertSplOrderDetailReport(splOrderDetailReport);
    }

    /**
     * 修改样品报告
     *
     * @param splOrderDetailReport 样品报告
     * @return 结果
     */
    @Override
    public int updateSplOrderDetailReport(SplOrderDetailReport splOrderDetailReport)
    {
        splOrderDetailReport.setUpdateBy(SecurityUtils.getUsername());
        splOrderDetailReport.setUpdateTime(DateUtils.getNowDate());
        return splOrderDetailReportMapper.updateSplOrderDetailReport(splOrderDetailReport);
    }

    /**
     * 批量删除样品报告
     *
     * @param orderDetailReportIds 需要删除的样品报告ID
     * @return 结果
     */
    @Override
    public int deleteSplOrderDetailReportByIds(String[] orderDetailReportIds)
    {
        return splOrderDetailReportMapper.deleteSplOrderDetailReportByIds(orderDetailReportIds);
    }

    /**
     * 删除样品报告信息
     *
     * @param orderDetailReportId 样品报告ID
     * @return 结果
     */
    @Override
    public int deleteSplOrderDetailReportById(String orderDetailReportId)
    {
        return splOrderDetailReportMapper.deleteSplOrderDetailReportById(orderDetailReportId);
    }
}
